package com.pks.autoInsurance.helper;

import com.pks.autoInsurance.dao.RegistrationDAO;
import com.pks.autoInsurance.dao.RegistrationDAOImpl;
import com.pks.autoInsurance.dao.VehicleDAO;
import com.pks.autoInsurance.dao.VehicleDAOImpl;
import com.pks.autoInsurance.dto.RegistrationDto;
import com.pks.autoInsurance.dto.VehicleDto;

/**
 * Performs activities related to the Registration.
 * 
 * @author Pankaj Soni
 * 
 */
public class RegistrationHelper {
	/**
	 * Performs registration of the user.
	 * 
	 * @param registrationDtoReq
	 * @return boolean
	 */
	public boolean registerUser(RegistrationDto registrationDtoReq) {
		System.out.println(getClass() + "::::registerUser::::begin");
		RegistrationDAO registrationDAO = new RegistrationDAOImpl();
		System.out.println("::::registrationDtoReq::::" + registrationDtoReq);
		return registrationDAO.createUser(registrationDtoReq);
	}

	/**
	 * Checks for existing user.
	 * 
	 * @param registrationDtoReq
	 * @return boolean
	 */
	public boolean isExistingUser(RegistrationDto registrationDtoReq) {
		System.out.println(getClass() + "::::isExistingUser::::begin");
		RegistrationDAO registrationDAO = new RegistrationDAOImpl();
		System.out.println("::::loginDtoReq::::" + registrationDtoReq);
		return registrationDAO.isExistingUser(registrationDtoReq);
	}

	/**
	 * Registers vehicle of user.
	 * 
	 * @param vehicleDto
	 * @return boolean
	 */
	public boolean registerVehicle(VehicleDto vehicleDto) {
		System.out.println(getClass() + "::::registerVehicle::::begin");
		VehicleDAO vehicleDAO = new VehicleDAOImpl();
		return vehicleDAO.updateVehicle(vehicleDto);
	}

	/**
	 * Update user info.
	 * 
	 * @param registrationDtoReq
	 * @return boolean
	 */
	public boolean updateUser(RegistrationDto registrationDtoReq) {
		System.out.println(getClass() + "::::updateUser::::begin");
		RegistrationDAO registrationDAO = new RegistrationDAOImpl();
		System.out.println("::::registrationDtoReq::::" + registrationDtoReq);
		return registrationDAO.updateUser(registrationDtoReq);
	}

}
